#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5+10;
int s[maxn];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);

    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);

    int n,ans = 0;
    cin>>n;

    int canbe_bt=0,canbt=0;
    for(int i = 1;i <= n;i++)
    {
        int tmp;cin>>tmp;
        s[tmp]++;
    }

    for(int i = 1;i <= maxn;i++)
    {
        if(s[i] == 0) continue;

        canbt = s[i];
        if(canbe_bt < canbt)
        {
            ans += canbe_bt;
            canbt -= canbe_bt;
            canbe_bt = 0;
        }
        if(canbe_bt >= canbt)
        {
            //cout<<111;
            ans += canbt;
            canbe_bt -= canbt;
            canbt = 0;
        }
        canbe_bt += s[i];

        //cout<<canbe_bt<<'\n';
    }
    cout<<n-ans;
    return 0;
}
